#练习10-3
'''
filename = 'guest.txt'
username = input("输入用户名：")
with open(filename,'w') as file_object:
    file_object.write(username)
'''

#练习10-4
filename = 'guest_book.txt'
active = True
while active:
    username = input("请输入用户名：")
    with open(filename,'w') as file_object:
        file_object.write(username)
        print(f"{filename} 已添加！")
